<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>03-key的作用及原理</title>
</head>
<body>
  <div id="demo">
    <p v-for="item in items" :key="item">{{ item }}</p>
  </div>
  <script src="/vue.js"></script>
  <script>
    const app = new Vue({
      el: '#demo',
      data: { items: ['a', 'b', 'c', 'd', 'e'] },
      mounted() {
        setTimeout(() => {
          this.items.splice(2, 0, 'f')
        }, 2000);
      }
    })
  </script>
</body>
</html>